let fs = require('fs');
let user = {
    username: "admin1",
    password: "12345",
};
function login(){
     let data = fs.readFileSync("./persons.json");
    let arr = JSON.parse(data.toString());
    let tag = false;
    for(let item of arr){
        if(item.username == user.username && item.password ==user.password){
            tag=true;
            console.log('登录成功');
        }else{
            tag=false;
            console.log('用户名和密码错误');
        };
    };
};
login();